package com.qumitech.visualnovel.controller.rest.novel;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import com.qumitech.visualnovel.model.common.BaseResponse;
import com.qumitech.visualnovel.service.novel.DashboardService;

@RestController
@Api(value = "Dashboard模块", description = "Dashboard模块")
public class DashboardRest {
    @Autowired
    private DashboardService dashboardService;

    @ApiOperation(value = "作者列表", notes = "作者列表")
    @GetMapping("/api/dashboard/author/list")
    public BaseResponse authorList(
        @RequestParam(value="offset", required=false) Integer offset,
        @RequestParam(value="limit", required=false) Integer limit) {
        return dashboardService.authorList(offset, limit);
    }

    @ApiOperation(value = "小说列表", notes = "小说列表")
    @GetMapping("/api/dashboard/book/list")
    public BaseResponse bookList(
        @RequestParam(value="offset", required=false) Integer offset,
        @RequestParam(value="limit", required=false) Integer limit) {
        return dashboardService.bookList(offset, limit);
    }

    @ApiOperation(value = "dashboard主页", notes = "dashboard主页")
    @GetMapping("/api/dashboard/home")
    public BaseResponse dashboardHome() {
        return dashboardService.dashboardHome();
    }
}
